﻿CREATE TABLE [dbo].[sys_Config]
(
	[ConfigID] INT NOT NULL PRIMARY KEY IDENTITY, 
    [Name] NVARCHAR(50) NOT NULL , 
    [ModuleID] INT NOT NULL DEFAULT 0, 
    [DataType] NVARCHAR(255) NOT NULL DEFAULT '', 
    [Value] NVARCHAR(MAX) NULL, 
    [ConfigLevel] INT NULL check( [ConfigLevel] in (0,1)), 
    [Comment] NVARCHAR(200) NULL, 

    CONSTRAINT [FK_sys_Config_ModuleID] FOREIGN KEY ([ModuleID]) REFERENCES [sys_Modules]([ModuleID]), 
)

GO

CREATE UNIQUE INDEX [IX_sys_Config_NameModule] ON [dbo].[sys_Config] ([Name], [ModuleID])
